Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2StorageUtil = require("StorageUtil");
var $2ObjUtil = require("ObjUtil");
var $2GameEvent = require("GameEvent");
var $2EventCenter = require("EventCenter");
var $2EventDefine = require("EventDefine");
var $2ServerConfig = require("ServerConfig");
var $2ConstValue = require("ConstValue");

var d;
(function (e) {
  e[e.Wait = 0] = "Wait";
  e[e.Handover = 1] = "Handover";
  e[e.Reday = 2] = "Reday";
})(d || (d = {}));
var h = {};
var u = false;
var g = [];
var def_GameUser = /* */function () {
  function _ctor() {
    babel_classCallCheck(this, _ctor);
    this.serverStatus = d.Wait;
    this.gamename = "hzzc";
    this.phonemodel = "";
    this._uid = 0;
    this.localCode = 0;
    this.changes = new Map();
    this._name = "";
    this._icon = "";
    this.gameTiliCd = 0;
    this.addDesktopState = false;
    this.desktopDailyReward = false;
    this.sidebarReward = false;
    this.collectionReward = false;
    this.hasCollected = false;
    this.keyChain = {};
    this.user_group_id = "no";
    this._ISIOS = false;
    this._openid = "";
    this._id = -1;
    this._curlevelType = "";
    this._videoType = 0;
    this._guide = 0;
    this._audio = true;
    this._FreeVideo = false;
    this._bgm = true;
    this._tilitime = 0;
    this.unlockLevel = {};
    this.complete = {};
    this.unlockTip = {};
    this.unlockSkin = {};
    this._curr_skin = "0";
    this.unlockSkin_stone = {};
    this._curr_skin_stone = "0";
    this.unlockSkin_spine = {};
    this._curr_skin_spine = "0";
    this._tili = 5;
    this._yilingqu = 0;
    this.FreeDate = {};
    this._curlevelName = "game_2";
    this.addDeskReward = 0;
    this.enterFromCollect = 0;
    this.enterFromSidebar = 0;
    this.enterFromDesk = 0;
    this.receiveSidebarRewardTime = 0;
    this.receiveDeskRewardTime = 0;
    this.receiveCollectRewardTime = 0;
    this.receivedDeskReward = 0;
    this.receivedCollectReward = 0;
    this._desktopShortcut = false;
    this._gtime = 0;
    this._lastEndTime = 0;
    this._shovel = 0;
    this._gameAB = 0;
    this._LevelsType = 0;
    this._maxlevel = 1;
    this.levelTip = {};
    this.UserInfo = null;
    this._videoenergy = 0;
    this._countDay = 1;
    this.level_duomaomao_sanguo = 0;
    this.templevel = {};
    this._IsAgree = false;
    this._upSocreed = false;
    this._IsShowGameWin = true;
    this._levelOtherPaiXu = [];
    this._bombCount = 0;
    this._bomb = false;
    this._loginDay = new Date().getDate();
    this._useFreeVideoOnece = false;
    this._freeVideoOnece = false;
    this._freeVideoOneceTime = -1;
    this._freeVideoOneceTime_week = 0;
    this.zfbLevelInfo = {};
    this._shareVideoNum = 0;
    this._gameOverNum = 0;
    this._freeVideoByOneDay = -1;
    this._freeVideoByTwoHours = -1;
    this._isFreeDayCD = false;
    this._isFreeTwoHourCD = false;
    this._InterstitialCanShowTime = 0;
    this._NewPlayerInTime = 0;
    this._IsNewPlayer = true;
    this._playnum = -1;
    this._PassLevelNum = 0;
    this._PassLevelNum_day = 0;
    this._PassLevelNum_week = 0;
    this._PassLevelNum_month = 0;
    this._PassLevelNum_yjwj = 0;
    this._PassLevelNum_day_yjwj = 0;
    this._PassLevelNum_week_yjwj = 0;
    this._PassLevelNum_month_yjwj = 0;
    this._beforeSeeVideoTime = new Date().getTime();
    this._beforeUseTime = 0;
    this._lastday = "";
    this._lastMonth = "";
    this._dijizhou = 0;
    this._curr_rand = 0;
    this.freeVideoTime = {};
    this.freeVideoFirstTime = {};
    this.freeVideoCount = {};
    this.newdata = false;
    this.showtip = "";
    this.tempTime = 0;
    this._isNeedSaveData = false;
  }
  return babel_createClass(_ctor, [{
    key: "checkAuthorization",
    value: function checkAuthorization() {
      return !(null == this.id || this.id < 0) && null != this.icon && "" != this.icon;
    }
  }, {
    key: "uid",
    get() {
      return this._uid;
    },
    set(e) {
      this._uid = e;
      u = true;
      this.changes.set("_uid", this._uid);
    }
  }, {
    key: "setGameTiliCd",
    value: function setGameTiliCd(e) {
      this.gameTiliCd += e;
      this.changes.set("gameTiliCd", this.gameTiliCd);
    }
  }, {
    key: "getGameTiliCd",
    value: function getGameTiliCd() {
      return this.gameTiliCd;
    }
  }, {
    key: "setAddDesktopState",
    value: function setAddDesktopState(e) {
      this.addDesktopState = e;
      this.changes.set("addDesktopState", this.addDesktopState);
    }
  }, {
    key: "getAddDesktopState",
    value: function getAddDesktopState() {
      return this.addDesktopState;
    }
  }, {
    key: "setDesktopDailyRewardClaimState",
    value: function setDesktopDailyRewardClaimState(e) {
      this.desktopDailyReward = e;
      this.changes.set("desktopDailyReward", this.desktopDailyReward);
    }
  }, {
    key: "getDesktopDailyRewardClaimState",
    value: function getDesktopDailyRewardClaimState() {
      return this.desktopDailyReward;
    }
  }, {
    key: "setSidebarRewardClaimState",
    value: function setSidebarRewardClaimState(e) {
      this.sidebarReward = e;
      this.changes.set("sidebarReward", this.sidebarReward);
    }
  }, {
    key: "getSidebarRewardClaimState",
    value: function getSidebarRewardClaimState() {
      return this.sidebarReward;
    }
  }, {
    key: "setCollectionRewardClaimState",
    value: function setCollectionRewardClaimState(e) {
      this.collectionReward = e;
      this.changes.set("collectionReward", this.collectionReward);
    }
  }, {
    key: "getCollectionRewardClaimState",
    value: function getCollectionRewardClaimState() {
      return this.collectionReward;
    }
  }, {
    key: "setCollectedState",
    value: function setCollectedState(e) {
      this.hasCollected = e;
      this.changes.set("hasCollected", this.hasCollected);
    }
  }, {
    key: "getCollectedState",
    value: function getCollectedState() {
      return this.hasCollected;
    }
  }, {
    key: "hasKey",
    value: function hasKey(e) {
      return this.keyChain[e] >= 1;
    }
  }, {
    key: "setKey",
    value: function setKey(e, t) {
      this.keyChain[e] = t;
      u = true;
      this.changes.set("keyChain", this.keyChain);
    }
  }, {
    key: "ISIOS",
    get() {
      return this._ISIOS;
    },
    set(e) {
      this._ISIOS = e;
    }
  }, {
    key: "openid",
    get() {
      return this._openid;
    },
    set(e) {
      if (this._openid != e) {
        this._openid = e;
        this.changes.set("_openid", this._openid);
        u = true;
      }
    }
  }, {
    key: "curlevelType",
    get() {
      return this._curlevelType;
    },
    set(e) {
      this._curlevelType = e;
      this.changes.set("_curlevelType", this._curlevelType);
      u = true;
    }
  }, {
    key: "videoType",
    get() {
      return this._videoType;
    },
    set(e) {
      this._videoType = e;
    }
  }, {
    key: "id",
    get() {
      return this._id;
    },
    set(e) {
      if (this._id != e) {
        this._id = e;
        u = true;
        this.changes.set("_id", this._id);
        u = true;
      }
    }
  }, {
    key: "guide",
    get() {
      return this._guide;
    },
    set(e) {
      this._guide = e;
      u = true;
      this.changes.set("_guide", this._guide);
    }
  }, {
    key: "name",
    get() {
      return this._name;
    },
    set(e) {
      if (this._name != e) {
        this._name = e;
        this.changes.set("_name", this._name);
      }
    }
  }, {
    key: "icon",
    get() {
      return this._icon;
    },
    set(e) {
      if (this._icon != e) {
        this._icon = e;
        this.changes.set("_icon", this._icon);
      }
    }
  }, {
    key: "audio",
    get() {
      return this._audio;
    },
    set(e) {
      this._audio = e;
      this.changes.set("_audio", this._audio);
    }
  }, {
    key: "FreeVideo",
    get() {
      return this._FreeVideo;
    },
    set(e) {
      this._FreeVideo = e;
    }
  }, {
    key: "bgm",
    get() {
      return this._bgm;
    },
    set(e) {
      this._bgm = e;
      this.changes.set("_bgm", this._bgm);
    }
  }, {
    key: "tilitime",
    get() {
      return this._tilitime;
    },
    set(e) {
      this._tilitime = e;
      cc.sys.localStorage.setItem(this.gamename + "_tilitime", this._tilitime);
      $2EventCenter.default.postWaitEvent($2EventDefine.default.EVENT_TILITIME, this.tilitime);
    }
  }, {
    key: "setUnlockLevel",
    value: function setUnlockLevel(e, t) {
      var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
      if (this.unlockLevel[e] != t) {
        this.unlockLevel[e] = t;
        n && this.saveDatas();
      }
      this.changes.set("unlockLevel", this.unlockLevel);
    }
  }, {
    key: "getUnlockLevel",
    value: function getUnlockLevel(e) {
      return null != this.unlockLevel[e] && this.unlockLevel[e];
    }
  }, {
    key: "setcomplete",
    value: function setcomplete(e, t) {
      var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
      if (this.complete[e] != t) {
        this.complete[e] = t;
        n && this.saveDatas();
      }
      this.changes.set("complete", this.complete);
    }
  }, {
    key: "getcomplete",
    value: function getcomplete(e) {
      return null != this.complete[e] && this.complete[e];
    }
  }, {
    key: "getCompletenum",
    value: function getCompletenum() {
      var e = 0;
      for (var _t12 in this.complete) {
        this.complete[_t12] && e++;
      }
      return e;
    }
  }, {
    key: "setUnlockTip",
    value: function setUnlockTip(e, t) {
      this.unlockTip[e] = t;
      this.changes.set("unlockTip", this.unlockTip);
    }
  }, {
    key: "getUnlockTip",
    value: function getUnlockTip(e) {
      return null != this.unlockTip[e] && this.unlockTip[e];
    }
  }, {
    key: "setUnlockSkin",
    value: function setUnlockSkin(e, t) {
      this.unlockSkin[e] = t;
      this.changes.set("unlockSkin", this.unlockSkin);
    }
  }, {
    key: "getUnlockSkin",
    value: function getUnlockSkin(e) {
      return null != this.unlockSkin[e] && this.unlockSkin[e];
    }
  }, {
    key: "curr_skin",
    get() {
      return this._curr_skin;
    },
    set(e) {
      this._curr_skin = e;
      this.changes.set("_curr_skin", this._curr_skin);
    }
  }, {
    key: "setUnlockSkin_stone",
    value: function setUnlockSkin_stone(e, t) {
      this.unlockSkin_stone[e] = t;
      this.changes.set("unlockSkin_stone", this.unlockSkin_stone);
    }
  }, {
    key: "getUnlockSkin_stone",
    value: function getUnlockSkin_stone(e) {
      return null != this.unlockSkin_stone[e] && this.unlockSkin_stone[e];
    }
  }, {
    key: "curr_skin_stone",
    get() {
      return this._curr_skin_stone;
    },
    set(e) {
      this._curr_skin_stone = e;
      this.changes.set("_curr_skin_stone", this._curr_skin_stone);
    }
  }, {
    key: "setUnlockSkin_spine",
    value: function setUnlockSkin_spine(e, t) {
      this.unlockSkin_spine[e] = t;
      this.changes.set("unlockSkin_spine", this.unlockSkin_spine);
    }
  }, {
    key: "getUnlockSkin_spine",
    value: function getUnlockSkin_spine(e) {
      return null != this.unlockSkin_spine[e] && this.unlockSkin_spine[e];
    }
  }, {
    key: "curr_skin_spine",
    get() {
      return this._curr_skin_spine;
    },
    set(e) {
      this._curr_skin_spine = e;
      this.changes.set("_curr_skin_spine", this._curr_skin_spine);
    }
  }, {
    key: "tili",
    get() {
      return this._tili;
    },
    set(e) {
      this._tili = e;
      u = true;
      this.changes.set("_tili", this._tili);
    }
  }, {
    key: "yilingqu",
    get() {
      return this._yilingqu;
    },
    set(e) {
      this._yilingqu = e;
      u = true;
      this.changes.set("_yilingqu", this._yilingqu);
    }
  }, {
    key: "setUnlocktili",
    value: function setUnlocktili(e, t) {
      this.FreeDate[e] = t;
      this.changes.set("FreeDate", this.FreeDate);
    }
  }, {
    key: "getUnlocktili",
    value: function getUnlocktili(e) {
      return null != this.FreeDate[e] && this.FreeDate[e];
    }
  }, {
    key: "currlevelName",
    get() {
      return this._curlevelName;
    },
    set(e) {
      this._curlevelName = e;
      this.changes.set("_curlevelName", this._curlevelName);
    }
  }, {
    key: "receiveSidebarReward",
    value: function receiveSidebarReward() {
      this.receiveSidebarRewardTime = Date.now();
      this.enterFromSidebar = 0;
      this.changes.set("receiveSidebarRewardTime", this.receiveSidebarRewardTime);
      this.save();
    }
  }, {
    key: "receiveDeskReward",
    value: function receiveDeskReward() {
      var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
      if (e) {
        this.receivedDeskReward = 1;
        this.changes.set("receivedDeskReward", this.receivedDeskReward);
      }
      this.receiveDeskRewardTime = Date.now();
      this.changes.set("receiveDeskRewardTime", this.receiveDeskRewardTime);
      this.enterFromDesk = 0;
      this.save();
    }
  }, {
    key: "receiveCollectReward",
    value: function receiveCollectReward() {
      var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
      if (e) {
        this.receivedCollectReward = 1;
        this.changes.set("receivedCollectReward", this.receivedCollectReward);
      }
      this.receiveCollectRewardTime = Date.now();
      this.changes.set("receiveCollectRewardTime", this.receiveCollectRewardTime);
      this.enterFromCollect = 0;
      this.save();
    }
  }, {
    key: "getTodayKey",
    value: function getTodayKey(e) {
      var t = new Date(e);
      return "".concat(t.getFullYear(), "_").concat(t.getMonth() + 1, "_").concat(t.getDate());
    }
  }, {
    key: "checkTodayReceiveSidebarReward",
    value: function checkTodayReceiveSidebarReward() {
      var e = this.receiveSidebarRewardTime || 0;
      return this.getTodayKey(e) == this.getTodayKey(Date.now());
    }
  }, {
    key: "checkTodayReceiveDeskReward",
    value: function checkTodayReceiveDeskReward() {
      var e = this.receiveDeskRewardTime || 0;
      return this.getTodayKey(e) == this.getTodayKey(Date.now());
    }
  }, {
    key: "checkTodayReceiveCollectReward",
    value: function checkTodayReceiveCollectReward() {
      var e = this.receiveCollectRewardTime || 0;
      return this.getTodayKey(e) == this.getTodayKey(Date.now());
    }
  }, {
    key: "desktopShortcut",
    get() {
      return this._desktopShortcut;
    },
    set(e) {
      this._desktopShortcut = e;
      this.changes.set("_desktopShortcut", this._desktopShortcut);
    }
  }, {
    key: "gtime",
    get() {
      return this._gtime;
    },
    set(e) {
      this._gtime = e;
      u = true;
      this.changes.set("_gtime", this._gtime);
    }
  }, {
    key: "lastEndTime",
    get() {
      return this._lastEndTime;
    },
    set(e) {
      this._lastEndTime = e;
      u = true;
      this.changes.set("_lastEndTime", this._lastEndTime);
    }
  }, {
    key: "shovel",
    get() {
      return this._shovel;
    },
    set(e) {
      this._shovel = Math.max(e, 0);
      this.changes.set("_shovel", this._shovel);
      $2EventCenter.default.postEvent("shovel", this._shovel);
    }
  }, {
    key: "gameAB",
    get() {
      return this._gameAB;
    },
    set(e) {
      this._gameAB = e;
      u = true;
      this.changes.set("_gameAB", this._gameAB);
    }
  }, {
    key: "LevelsType",
    get() {
      return this._LevelsType;
    },
    set(e) {
      this._LevelsType = e;
      u = true;
      this.changes.set("_LevelsType", this._LevelsType);
    }
  }, {
    key: "maxlevel",
    get() {
      return this._maxlevel;
    },
    set(e) {
      this._maxlevel = e;
      this.changes.set("_maxlevel", this._maxlevel);
    }
  }, {
    key: "addlevelTip",
    value: function addlevelTip(e) {
      this.levelTip[e] = 1;
      this.changes.set("levelTip", this.levelTip);
    }
  }, {
    key: "removelevelTip",
    value: function removelevelTip(e) {
      delete this.levelTip[e];
      this.changes.set("levelTip", this.levelTip);
    }
  }, {
    key: "userInfo",
    get() {
      return this.UserInfo;
    },
    set(e) {
      this.UserInfo = e;
      this.changes.set("UserInfo", JSON.stringify(this.UserInfo));
    }
  }, {
    key: "videoenergy",
    get() {
      return this._videoenergy;
    },
    set(e) {
      this._videoenergy = e;
      u = true;
      this.changes.set("_videoenergy", this._videoenergy);
    }
  }, {
    key: "countDay",
    get() {
      return this._countDay;
    },
    set(e) {
      this._countDay = e;
      u = true;
      this.changes.set("_countDay", this._countDay);
    }
  }, {
    key: "clearTemp",
    value: function clearTemp() {
      this.templevel = {};
    }
  }, {
    key: "getTemp",
    value: function getTemp(e) {
      return this.templevel[e];
    }
  }, {
    key: "setTemp",
    value: function setTemp(e, t) {
      this.templevel[e] = t;
    }
  }, {
    key: "IsAgree",
    get() {
      return this._IsAgree;
    },
    set(e) {
      this._IsAgree = e;
      u = true;
      this.changes.set("_IsAgree", this._IsAgree);
    }
  }, {
    key: "upSocreed",
    get() {
      return this._upSocreed;
    },
    set(e) {
      this._upSocreed = e;
      u = true;
      this.changes.set("_upSocreed", this._upSocreed);
    }
  }, {
    key: "IsShowGameWin",
    get() {
      return this._IsShowGameWin;
    },
    set(e) {
      this._IsShowGameWin = e;
      u = true;
      this.changes.set("_IsShowGameWin", this._IsShowGameWin);
    }
  }, {
    key: "levelOtherPaiXu",
    get() {
      return this._levelOtherPaiXu;
    },
    set(e) {
      this._levelOtherPaiXu = e;
      u = true;
      this.changes.set("_levelOtherPaiXu", this._levelOtherPaiXu);
    }
  }, {
    key: "bombCount",
    get() {
      return this._bombCount;
    },
    set(e) {
      this._bombCount = e;
      u = true;
      this.changes.set("_bombCount", e);
    }
  }, {
    key: "bomb",
    get() {
      return this._bomb;
    },
    set(e) {
      this._bomb = e;
      u = true;
      this.changes.set("_bomb", this._bomb);
    }
  }, {
    key: "loginDay",
    get() {
      return this._loginDay;
    },
    set(e) {
      this._loginDay = e;
      u = true;
      this.changes.set("_loginDay", this._loginDay);
    }
  }, {
    key: "useFreeVideoOnece",
    get() {
      return this._useFreeVideoOnece;
    },
    set(e) {
      this._useFreeVideoOnece = e;
      this.changes.set("_useFreeVideoOnece", this._useFreeVideoOnece);
    }
  }, {
    key: "freeVideoOnece",
    get() {
      return this._freeVideoOnece;
    },
    set(e) {
      this._freeVideoOnece = e;
      this.changes.set("_freeVideoOnece", this._freeVideoOnece);
    }
  }, {
    key: "freeVideoOneceTime",
    get() {
      return this._freeVideoOneceTime;
    },
    set(e) {
      this._freeVideoOneceTime = e;
      this.changes.set("_freeVideoOneceTime", this._freeVideoOneceTime);
      this.freeVideoOneceTime_week = e;
    }
  }, {
    key: "freeVideoOneceTime_week",
    get() {
      return this._freeVideoOneceTime_week;
    },
    set(e) {
      this._freeVideoOneceTime_week = e;
      this.changes.set("_freeVideoOneceTime_week", this._freeVideoOneceTime_week);
    }
  }, {
    key: "setZfbLevelComplete",
    value: function setZfbLevelComplete(e, t) {
      this.zfbLevelInfo[e] = t;
      this.changes.set("zfbLevelInfo", this.zfbLevelInfo);
    }
  }, {
    key: "getZfbLevelComplete",
    value: function getZfbLevelComplete(e) {
      return null != this.zfbLevelInfo[e] && this.zfbLevelInfo[e];
    }
  }, {
    key: "shareVideoNum",
    get() {
      return this._shareVideoNum;
    },
    set(e) {
      this._shareVideoNum = e;
      u = true;
      this.changes.set("_shareVideoNum", this._shareVideoNum);
      this._shareVideoNum > 3 && (this._shareVideoNum = 3);
      new Date().getTime() > this.freeVideoByOneDay && (this.freeVideoByOneDay = -1);
    }
  }, {
    key: "gameOverNum",
    get() {
      return this._gameOverNum;
    },
    set(e) {
      this._gameOverNum = e;
      u = true;
      this.changes.set("_gameOverNum", this._gameOverNum);
      this._gameOverNum > 5 && (this._gameOverNum = 5);
      new Date().getTime() > this.freeVideoByTwoHours && (this.freeVideoByTwoHours = -1);
    }
  }, {
    key: "freeVideoByOneDay",
    get() {
      return this._freeVideoByOneDay;
    },
    set(e) {
      this._freeVideoByOneDay = e;
      this.changes.set("_freeVideoByOneDay", this._freeVideoByOneDay);
    }
  }, {
    key: "freeVideoByTwoHours",
    get() {
      return this._freeVideoByTwoHours;
    },
    set(e) {
      this._freeVideoByTwoHours = e;
      this.changes.set("_freeVideoByTwoHours", this._freeVideoByTwoHours);
    }
  }, {
    key: "isFreeDayCD",
    get() {
      return this._isFreeDayCD;
    },
    set(e) {
      this._isFreeDayCD = e;
      u = true;
      this.changes.set("_isFreeDayCD", this._isFreeDayCD);
    }
  }, {
    key: "isFreeTwoHourCD",
    get() {
      return this._isFreeTwoHourCD;
    },
    set(e) {
      this._isFreeTwoHourCD = e;
      u = true;
      this.changes.set("_isFreeTwoHourCD", this._isFreeTwoHourCD);
    }
  }, {
    key: "getIsRenWuFree",
    value: function getIsRenWuFree() {
      var e = false;
      if (!$2ServerConfig.default.getInstance().gameconfig.config.isHadRenWu1) {
        return false;
      }
      var t = new Date().getTime();
      if (t < this.freeVideoByOneDay || t < this.freeVideoByTwoHours) {
        return e = true;
      } else {
        return e;
      }
    }
  }, {
    key: "chongzhiRenWu",
    value: function chongzhiRenWu() {
      this.shareVideoNum = 0;
      this.gameOverNum = 0;
      this.isFreeTwoHourCD = false;
      this.isFreeDayCD = false;
    }
  }, {
    key: "InterstitialCanShowTime",
    get() {
      return this._InterstitialCanShowTime;
    },
    set(e) {
      this._InterstitialCanShowTime = e;
      this.changes.set("_InterstitialCanShowTime", this._InterstitialCanShowTime);
    }
  }, {
    key: "NewPlayerInTime",
    get() {
      return this._NewPlayerInTime;
    },
    set(e) {
      this._NewPlayerInTime = e;
      u = true;
      this.changes.set("_NewPlayerInTime", this._NewPlayerInTime);
      this.save();
    }
  }, {
    key: "IsNewPlayer",
    get() {
      return this._IsNewPlayer;
    },
    set(e) {
      this._IsNewPlayer = e;
      u = true;
      this.changes.set("_IsNewPlayer", this._IsNewPlayer);
      this.save();
    }
  }, {
    key: "playnum",
    get() {
      return this._playnum;
    },
    set(e) {
      this._playnum = e;
      u = true;
      this.changes.set("_playnum", this._playnum);
      this.save();
    }
  }, {
    key: "PassLevelNum",
    get() {
      return this._PassLevelNum;
    },
    set(e) {
      this._PassLevelNum = e;
      u = true;
      this.changes.set("_PassLevelNum", this._PassLevelNum);
      this.save();
    }
  }, {
    key: "PassLevelNum_day",
    get() {
      return this._PassLevelNum_day;
    },
    set(e) {
      this._PassLevelNum_day = e;
      u = true;
      this.changes.set("_PassLevelNum_day", this._PassLevelNum_day);
      this.save();
    }
  }, {
    key: "PassLevelNum_week",
    get() {
      return this._PassLevelNum_week;
    },
    set(e) {
      this._PassLevelNum_week = e;
      u = true;
      this.changes.set("_PassLevelNum_week", this._PassLevelNum_week);
      this.save();
    }
  }, {
    key: "PassLevelNum_month",
    get() {
      return this._PassLevelNum_month;
    },
    set(e) {
      this._PassLevelNum_month = e;
      u = true;
      this.changes.set("_PassLevelNum_month", this._PassLevelNum_month);
      this.save();
    }
  }, {
    key: "PassLevelNum_yjwj",
    get() {
      return this._PassLevelNum_yjwj;
    },
    set(e) {
      this._PassLevelNum_yjwj = e;
      u = true;
      this.changes.set("_PassLevelNum_yjwj", this._PassLevelNum_yjwj);
      this.save();
    }
  }, {
    key: "PassLevelNum_day_yjwj",
    get() {
      return this._PassLevelNum_day_yjwj;
    },
    set(e) {
      this._PassLevelNum_day_yjwj = e;
      u = true;
      this.changes.set("_PassLevelNum_day_yjwj", this._PassLevelNum_day_yjwj);
      this.save();
    }
  }, {
    key: "PassLevelNum_week_yjwj",
    get() {
      return this._PassLevelNum_week_yjwj;
    },
    set(e) {
      this._PassLevelNum_week_yjwj = e;
      u = true;
      this.changes.set("_PassLevelNum_week_yjwj", this._PassLevelNum_week_yjwj);
      this.save();
    }
  }, {
    key: "PassLevelNum_month_yjwj",
    get() {
      return this._PassLevelNum_month_yjwj;
    },
    set(e) {
      this._PassLevelNum_month_yjwj = e;
      u = true;
      this.changes.set("_PassLevelNum_month_yjwj", this._PassLevelNum_month_yjwj);
      this.save();
    }
  }, {
    key: "beforeSeeVideoTime",
    get() {
      return this._beforeSeeVideoTime;
    },
    set(e) {
      this._beforeSeeVideoTime = e;
    }
  }, {
    key: "beforeUseTime",
    get() {
      return this._beforeUseTime;
    },
    set(e) {
      this._beforeUseTime = e;
      u = true;
      this.changes.set("_beforeUseTime", this._beforeUseTime);
    }
  }, {
    key: "lastday",
    get() {
      return this._lastday;
    },
    set(e) {
      this._lastday = e;
      u = true;
      this.changes.set("_lastday", this._lastday);
      this.save();
    }
  }, {
    key: "lastMonth",
    get() {
      return this._lastMonth;
    },
    set(e) {
      this._lastMonth = e;
      u = true;
      this.changes.set("_lastMonth", this._lastMonth);
      this.save();
    }
  }, {
    key: "dijizhou",
    get() {
      return this._dijizhou;
    },
    set(e) {
      this._dijizhou = e;
      u = true;
      this.changes.set("_dijizhou", this._dijizhou);
      this.save();
    }
  }, {
    key: "curr_rand",
    get() {
      return this._curr_rand;
    },
    set(e) {
      this._curr_rand = e;
      u = true;
      this.changes.set("_curr_rand", this._curr_rand);
      this.save();
    }
  }, {
    key: "setFreeVideoTime",
    value: function setFreeVideoTime(e) {
      this.freeVideoTime[e] = Date.now();
      delete this.freeVideoFirstTime[e];
      this.changes.set("freeVideoTime", this.freeVideoTime);
      this.changes.set("freeVideoFirstTime", this.freeVideoFirstTime);
    }
  }, {
    key: "getFreeVideoTime",
    value: function getFreeVideoTime(e) {
      if (null == this.freeVideoTime[e]) {
        return -1;
      } else {
        return this.freeVideoTime[e];
      }
    }
  }, {
    key: "setFreeVideoFirstTime",
    value: function setFreeVideoFirstTime(e) {
      this.freeVideoFirstTime[e] = Date.now();
      this.changes.set("freeVideoFirstTime", this.freeVideoFirstTime);
    }
  }, {
    key: "getFreeVideoFirstTime",
    value: function getFreeVideoFirstTime(e) {
      if (null == this.freeVideoFirstTime[e]) {
        return -1;
      } else {
        return this.freeVideoFirstTime[e];
      }
    }
  }, {
    key: "setFreeVideoCount",
    value: function setFreeVideoCount(e) {
      if (null == this.freeVideoCount[e]) {
        this.freeVideoCount[e] = 1;
      } else {
        this.freeVideoCount[e] += 1;
      }
      this.changes.set("freeVideoCount", this.freeVideoCount);
    }
  }, {
    key: "getFreeVideoCount",
    value: function getFreeVideoCount(e) {
      if (null == this.freeVideoCount[e]) {
        return 0;
      } else {
        return this.freeVideoCount[e];
      }
    }
  }, {
    key: "panduanweek",
    value: function panduanweek() {
      var e = false;
      this.getMondayTimestamp() - this.freeVideoOneceTime_week > 0 && (e = true);
      if (e) {
        this.freeVideoOnece = false;
        this.useFreeVideoOnece = false;
      }
    }
  }, {
    key: "getMondayTimestamp",
    value: function getMondayTimestamp() {
      var e = new Date();
      var t = (e.getDay() + 6) % 7;
      e.setHours(0, 0, 0, 0);
      return e.getTime() - 864e5 * t;
    }
  }, {
    key: "initdata",
    value: function initdata(e) {

      console.log("initdata", e);
      if (!e) {
        console.log("本地数据读取");
        var _i5 = 0;
        for (var _Object$keys = Object.keys(this); _i5 < _Object$keys.length; _i5++) {
          var _e21 = _Object$keys[_i5];
          var _t13 = _e21;
          "_" == _e21[0] && (_t13 = _e21.substring(1));
          this[_t13] = $2StorageUtil.default.getLocalItem(this.gamename + _e21, this[_e21]);
        }
      }
      this.InterstitialCanShowTime = new Date().getTime() + 3e4;
      var t = new Date().getDate();
      this.newdata = false;
      if (t != this.loginDay) {
        this.videoenergy = 0;
        this.newdata = true;
        this.loginDay = t;
        this.countDay += 1;
        this.chongzhiRenWu();
      }
      if (this.IsNewPlayer) {
        0 == this.NewPlayerInTime && (this.NewPlayerInTime = new Date().getTime());
        var _e22 = new Date().getTime() - this.NewPlayerInTime;
        console.log("timego:", _e22);
        _e22 > 864e5 && (this.IsNewPlayer = false);
      }
      var n = new Date().getTime() - this.beforeUseTime;
      var i = Math.floor(n / 6e5);
      console.log("tladd:", i);
      this.tili += i;
      if (this.tili > 5) {
        this.tili = 5;
        this.beforeUseTime = new Date().getTime();
      }
      this.panduanweek();
      $2EventCenter.default.regisEvent($2EventDefine.default.EVENT_UPDATE, this.gameUserUpdate, this);
      this.setFreeVideoTime("11111");
      this.freeTime();
      for (var _o25 in this.freeVideoFirstTime) {
        if (this.freeVideoFirstTime[_o25] && Math.floor(this.freeVideoFirstTime[_o25] + $2ConstValue.ConstValue.freeVideoTime - Date.now()) <= 0) {
          delete this.freeVideoFirstTime[_o25];
          delete this.freeVideoCount[_o25];
          this.changes.set("freeVideoFirstTime", this.freeVideoFirstTime);
          this.changes.set("freeVideoCount", this.freeVideoCount);
        }
      }
    }
  }, {
    key: "save",
    value: function save() {
      var e = {};
      var _iterator2 = babel_createForOfIteratorHelper(this.changes.keys());
      var _step2;
      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var _t14 = _step2.value;
          e[_t14] = this.changes.get(_t14);
          if ($2ObjUtil.default.isObject(e[_t14]) || $2ObjUtil.default.isArray(e[_t14])) {
            cc.sys.localStorage.setItem(this.gamename + _t14, JSON.stringify(e[_t14]));
          } else {
            cc.sys.localStorage.setItem(this.gamename + _t14, e[_t14]);
          }
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }
      this.changes.size > 0 && this.updateUserInfo();
      this.changes.clear();
    }
  }, {
    key: "updateUserInfo",
    value: function updateUserInfo() {
      if (this.serverStatus == d.Reday && 1 == u) {
        u = false;
        var _i6 = 0;
        for (var _g = g; _i6 < _g.length; _i6++) {
          var _e23 = _g[_i6];
          h.userinfo[_e23] = this[_e23];
        }
        console.log("userinfo", h);
        $2GameEvent.default.setuserinfo(h);
      }
      this.serverStatus == d.Handover && (this.serverStatus = d.Reday);
    }
  }, {
    key: "gameUserUpdate",
    value: function gameUserUpdate(e) {
      this.tempTime += e;
      if (this.tempTime >= 1) {
        this.tempTime = 0;
        this.freeTime();
      }
    }
  }, {
    key: "freeTime",
    value: function freeTime() {
      for (var _e24 in this.freeVideoTime) {
        if (this.freeVideoTime[_e24] && Math.floor(this.freeVideoTime[_e24] + $2ConstValue.ConstValue.freeVideoTime - new Date().getTime()) <= 0) {
          delete this.freeVideoTime[_e24];
          delete this.freeVideoCount[_e24];
          this.changes.set("freeVideoTime", this.freeVideoTime);
          this.changes.set("freeVideoCount", this.freeVideoCount);
          $2EventCenter.default.postEvent("refreshfreeVideoTime", _e24);
        }
      }
    }
  }, {
    key: "setIsNeedSaveData",
    value: function setIsNeedSaveData(e) {
      var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
      this._isNeedSaveData = e;
      u = true;
      this.changes.set("_isNeedSaveData", this._isNeedSaveData);
      t && this.saveDatas();
    }
  }, {
    key: "getIsNeedSaveData",
    value: function getIsNeedSaveData() {
      return this._isNeedSaveData;
    }
  }, {
    key: "saveDatas",
    value: function saveDatas() {
      if (!this.getIsNeedSaveData()) {
        return;
      }
      console.log("-----------------------------------------------------------------------");
      var e = "";
      var t = "";
      var n = "";
      for (var _o26 in this.complete) {
        "undefined" != _o26 && (t += "" == t ? _o26 : "+" + _o26);
      }
      for (var _o27 in this.unlockLevel) {
        "undefined" != _o27 && (n += "" == n ? _o27 : "+" + _o27);
      }
      e = t + "/" + n + "/" + (this.getIsNeedSaveData() ? 1 : 0);
      $2GameEvent.default.sendEvent("savedata", {
        data: e
      }, function (e) {
        console.log("savedata:res:", e);
      });
    }
  }, {
    key: "getDatas",
    value: function getDatas(e) {
      console.log("data:", e);
      if (null == e) {
        return;
      }
      var t = e.data.split("/");
      console.log("saveDt:", t);
      null != t[2] && 1 == t[2] && this.setIsNeedSaveData(true, false);
      if (this.getIsNeedSaveData()) {
        var _e25 = t[0].split("+");
        console.log("sz1:", _e25);
        var _n10 = t[1].split("+");
        console.log("sz2:", _n10);
        for (var _t15 = 0; _t15 < _e25.length; _t15++) {
          this.setcomplete(_e25[_t15], true, false);
        }
        for (var _t16 = 0; _t16 < _n10.length; _t16++) {
          this.setUnlockLevel(_n10[_t16], true, false);
        }
      }
      console.log("-----------------------------------------------------------------------");
    }
  }], [{
    key: "getInstance",
    value: function getInstance() {
      if (null == this._instance) {
        this._instance = new _ctor();
        this._instance.initdata();
        setInterval(this._instance.save.bind(this._instance), 1e3);
        window.wx && window.wx.getSystemInfoSync && (this._instance.phonemodel = wx.getSystemInfoSync().model);
      }
      return this._instance;
    }
  }]);
}();
exports.default = def_GameUser;
def_GameUser._instance = null;